#include "stdafx.h"
#include "./tmControl.h"

using namespace GLES;

VOID tmControl::onInput( int x,int y,InputType type ,GLES::RectI* parent)
{
	RectI o;
	Tool::translationRect(&o,&_rect,parent);
	if(type == MouseDn && Tool::isPointInRect(PointI(x,y),o))
	{
		_State = Pressed;
		return onPressed(x,y);
	}
	else if(type == MouseMv && (_State == Pressed || _State == Dragged))
	{
		_State = Dragged;
		return onDragged(x,y);
	}
	else if(type == MouseUp)
	{
		
		if(_State == Pressed)
		{
			_State = Released;
			return onPressRelease(x,y);
		}
		else if(_State == Dragged)
		{
			_State = Released;
			return onDragRelease(x,y);
		}
		
	}
	return ;
}

VOID tmControl::onPressRelease( int x,int y )
{

}

VOID tmControl::onDragged( int x,int y )
{

}

VOID tmControl::onPressed( int x,int y )
{
	
}

VOID tmControl::onDragRelease( int x,int y )
{

}
